import { symlinkSync, existsSync, statSync, unlinkSync, rmSync } from 'fs';
import * as path from 'path';
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
console.log(__filename, __dirname);

// 开发环境下直接使用符号链接调用外部的m-design-graph
// if (existsSync('../m-design-graph')) {
//  if (!existsSync('./node_modules/m-design-graph')) {

//    symlinkSync('../../m-design-graph', './node_modules/m-design-graph', 'dir');

//  } else {
//    const existStat = statSync('./node_modules/m-design-graph');
//    if (!existStat.isSymbolicLink()) {
//      rmSync('./node_modules/m-design-graph', { recursive: true, force: true });
//      symlinkSync('../../m-design-graph', './node_modules/m-design-graph', 'dir');
//    }
//  }
// }

